<?php
	include("initialize.php");
?>
<html>
<head>
	<title>GradeGrid - Account Settings</title>
	<?php include("header.php"); ?>
</head>
<body onLoad="writeCopyright()" onUnload="if (win && win.open && !win.closed) win.close()">
	<div class="main">
		
		<?php include("boilerplate.php"); ?>
		<?php include("loginnavigation.php"); ?>
        <?php include("fetchData.php"); ?>
		
		<?php if($_SESSION["logged_in"]): ?>
        	<?php $result=fetchAccountSchoolJoin();?>
			<div style="float: left;">
			<span><a href="accountSettingsP.php">Personal Settings</a> | School Settings | <a href="accountSettingsC.php">Class Settings</a></span>
            <hr />
            <h1>Affliliations <input type="button" value="Add a school" onClick="win=window.open('addSchool.php','Add a School','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400');"></h1>
            <?php if(mysql_num_rows($result)==0){?>
                <span>You do not have any templates yet.</span>
                <ul>
            <?php }else{
				while($data=mysql_fetch_array($result))
					echo "<li>".$data['school_name']." <input type=\"button\" value=\"Edit\" onClick=\"win=window.open('editSchool.php?school_id=".$data['school_id']."','Add a School','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=600,height=400');\"> <input type=\"button\" value=\"Delete\" onclick=\"window.location='deleteSchool.php?school_id=".$data['school_id']."'\"></li>";
            }?>
			</ul></div>
		<?php else: ?>
			<?php executeFile("../files/access_error.txt"); ?>
		<?php endif ?>
        <?php mysql_close();?>
	</div>
	<div id="copywright"></div>
</body>
</html>